package ControlLayer;
import java.util.ArrayList;
import ModelLayer.*;

/**
 * This is a controller class for Private customer list
 * 
 * @author (dmab0913 Gruppe4) 
 * @version (a version number or a date)
 */
public class PrivateCustomerCtr
{
    private PrivateCustomerContainer pCon;

    /**
     * Constructor for objects of class PrivateCustomerCtr
     */
    public PrivateCustomerCtr()
    {
        pCon = pCon.getInstance();
    }

    /**
     * controller deletes a person in the privateCustomerContainer
     */
    public void deleteCustomer(String phone)
    {
        pCon.deletePrivateCustomer(phone);
    }

    /**
     * controller finds a private Customer
     */
    public PrivateCustomer findPrivateCustomer(String phone)
    {
        return pCon.findPrivateCustomer(phone);
    }

    /**
     * controller creates an object of a private customer and 
     * puts it in the container
     */
    public void createPrivateCustomer(int account, String name, String address, String phone, int postalCode, String city, String email)
    {
        PrivateCustomer privateCustomer = new PrivateCustomer(account, name, address, phone, postalCode, city, email);
        pCon.addPrivateCustomers(privateCustomer);
    }

    /**
     * controller updates an object of the class private customer
     */
    public void updatePrivateCustomer(String phone, String newName, String newAddress, String newPhone, int newPostalCode, String newCity, String newEmail)
    {
        pCon.updatePrivateCustomer(phone, newName, newAddress, newPhone, newPostalCode, newCity, newEmail);  
    }

    /**
     * finds a customer-object and uses a mutator method to set its name
     */
    public void setName(String phone, String name)
    {
        pCon.findPrivateCustomer(phone).setName(name);
    }

    /**
     * finds a customer-object and uses a mutator method to set its address
     */
    public void setAddress(String phone, String address)
    {
        pCon.findPrivateCustomer(phone).setAddress(address);
    }

    /**
     * finds a customer-object and uses a mutator method to set its postalcode
     */
    public void setPostalCode(String phone, int postalCode)
    {
        pCon.findPrivateCustomer(phone).setPostalCode(postalCode);
    }

    /**
     * finds a customer-object and uses a mutator method to set its city
     */
    public void setCity(String phone, String city)
    {
        pCon.findPrivateCustomer(phone).setCity(city);
    }

    /**
     * finds a customer-object and uses a mutator method to set its telefon
     */
    public void setPhone(String phone, String phone2)
    {
        pCon.findPrivateCustomer(phone).setPhone(phone2);
    }
}
